package org.bspv.pharma.web.decorator;

import java.util.Date;

import javax.servlet.jsp.PageContext;

import org.apache.struts2.util.DateFormatter;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;

public class SampleDateDecorator implements org.displaytag.decorator.DisplaytagColumnDecorator{

	private static DateFormatter dateFormatter = new DateFormatter();
	private String format = "dd/MM/yyyy";
	/**
	 * 
	 */
	public Object decorate(Object date, PageContext context, MediaTypeEnum _enum)
			throws DecoratorException {
		Date d = (Date) date;
		dateFormatter.setFormat(format);
		dateFormatter.setDate(d);
		return dateFormatter.getFormattedDate();
	}

}
